import { IMessageBase } from "../../Framework/MQ/IMessageBase";
import { MessageManager } from "../../Framework/MQ/MessageManager";
import { SerializeStream } from "../../Framework/Serialize/SerializeStream";
import { SeqIntHelper } from "../Public/SeqIntHelper";
import { SeqStringHelper } from "../Public/SeqStringHelper";
import { SeqPlayerItemHelper } from "../Public/SeqPlayerItemHelper";
import { SeqSPetInfoHelper } from "./SeqSPetInfoHelper";
import { SPublicMiniPlayer } from "../Public/SPublicMiniPlayer";
import { SEntityId } from "../Public/SEntityId";
type int = number;
//class SChatMsg

export class SChatMsg extends IMessageBase {
  constructor(arg1: Boolean = false) {
    
    super();if (arg1) {
      MessageManager.instance().regist(this);
    }
  }

  public /* override */ getType(): int {
    return this._type;
  }

  public /* override */ clone(): IMessageBase {
    return new SChatMsg();
  }

  public /* override */ __write(arg1: SerializeStream): void {
    this.fromPlayer.__write(arg1);
    arg1.writeBool(this.gmFlag);
    arg1.writeBool(this.guideFlag);
    arg1.writeBool(this.crossFlag);
    arg1.writeByte(this.force);
    arg1.writeString(this.toPlayerName);
    this.toEntityId.__write(arg1);
    arg1.writeInt(this.chatType);
    SeqIntHelper.write(arg1, this.chatTypeEx);
    arg1.writeString(this.content);
    arg1.writeInt(this.font);
    arg1.writeDate(this.chatDt);
    arg1.writeString(this.bubbleId);
    SeqStringHelper.write(arg1, this.extend);
    SeqPlayerItemHelper.write(arg1, this.playerItems);
    SeqSPetInfoHelper.write(arg1, this.petInfos);
  }

  public /* override */ __read(arg1: SerializeStream): void {
    this.fromPlayer = new SPublicMiniPlayer();
    this.fromPlayer.__read(arg1);
    this.gmFlag = arg1.readBool();
    this.guideFlag = arg1.readBool();
    this.crossFlag = arg1.readBool();
    this.force = arg1.readByte();
    this.toPlayerName = arg1.readString();
    this.toEntityId = new SEntityId();
    this.toEntityId.__read(arg1);
    this.chatType = arg1.readInt();
    this.chatTypeEx = SeqIntHelper.read(arg1);
    this.content = arg1.readString();
    this.font = arg1.readInt();
    this.chatDt = arg1.readDate();
    this.bubbleId = arg1.readString();
    this.extend = SeqStringHelper.read(arg1);
    this.playerItems = SeqPlayerItemHelper.read(arg1);
    this.petInfos = SeqSPetInfoHelper.read(arg1);
  }

  public /* const */ _type: int = 12008;

  public /* var */ fromPlayer!: SPublicMiniPlayer;

  public /* var */ gmFlag!: Boolean;

  public /* var */ guideFlag!: Boolean;

  public /* var */ crossFlag!: Boolean;

  public /* var */ force!: int;

  public /* var */ toPlayerName!: string;

  public /* var */ toEntityId!: SEntityId;

  public /* var */ chatType!: int;

  public /* var */ chatTypeEx!: Array<any>;

  public /* var */ content!: string;

  public /* var */ font!: int;

  public /* var */ chatDt!: Date;

  public /* var */ bubbleId!: string;

  public /* var */ extend!: Array<any>;

  public /* var */ playerItems!: Array<any>;

  public /* var */ petInfos!: Array<any>;

  public static /* var */ _regist: SChatMsg = new SChatMsg(true);
}
